
/******************************************************************************
*@file  : acm32f42x_coreboard.h
*@brief : This file provides set of firmware functions to manage Leds and push-button available on ACM32F42X Core Board 
******************************************************************************/

#ifndef __ACM32F42X_COREBOARD_H
#define __ACM32F42X_COREBOARD_H
                                            
#include "hal.h"

#define BSP_LED_GPIO            GPIOA
#define BSP_LED_PIN             GPIO_PIN_6
#define BSP_LED_MODE            GPIO_MODE_OUTPUT_PP
#define BSP_LED_PULL            GPIO_PULLUP
#define BSP_LED_DRIVE           GPIO_DRIVE_LEVEL3
#define BSP_LED_ALTERNATE       GPIO_FUNCTION_0
#define BSP_LED_CLK_ENABLE()    __HAL_RCC_GPIOA_CLK_ENABLE()

#define BSP_PB_GPIO             GPIOB
#define BSP_PB_PIN              GPIO_PIN_0
#define BSP_PB_MODE             GPIO_MODE_IT_FALLING
#define BSP_PB_PULL             GPIO_PULLUP
#define BSP_PB_DRIVE            GPIO_DRIVE_LEVEL3
#define BSP_PB_ALTERNATE        GPIO_FUNCTION_0
#define BSP_PB_IRQ              EXTI0_IRQn
#define BSP_PB_CLK_ENABLE()    __HAL_RCC_GPIOB_CLK_ENABLE()

#define BSP_MCO1_GPIO            GPIOB
#define BSP_MCO1_PIN             GPIO_PIN_4
#define BSP_MCO1_MODE            GPIO_MODE_AF_PP
#define BSP_MCO1_PULL            GPIO_PULLUP
#define BSP_MCO1_DRIVE           GPIO_DRIVE_LEVEL3
#define BSP_MCO1_ALTERNATE       GPIO_FUNCTION_0
#define BSP_MCO1_CLK_ENABLE()    __HAL_RCC_GPIOB_CLK_ENABLE()


void get_reset_source(void);
void BSP_MCO_Init(uint32_t mco, uint32_t div);
void BSP_LED_Init(void);
void BSP_LED_On(void);
void BSP_LED_Off(void);
void BSP_LED_Toggle(void);
void BSP_PB_Init(void);
uint32_t BSP_PB_GetState(void);
void BSP_UART_Init(UART_TypeDef *uartx);
void BSP_UART_DeInit(void);

#endif /* __ACM32F42X_CORE_H */

